<template>
  <div class="page-department">
    <div class="component-mainHeader">
      <div class="top">
        <div class="topleft">
          <p>
            <span class="iconfont" style="color:#1abc9a;margin-right:3px;">&#xe607;</span>仓库管理
          </p>
        </div>
        <div class="topright">
          <el-button type="info" @click="$router.go(0)">
            <span style="font-weight:700;margin-right:5px;" class="iconfont">&#xe662;</span>刷新
          </el-button>
        </div>
      </div>
    </div>
    <div class="component-listHeader">
      <div class="search-header">
        <div class="left-title">
          <p class="left-text">
            <span class="iconfont">&#xe61e;</span>
            {{title}}
          </p>
          <p class="left-text" @click="$router.push({name:'addStock',params:{info:'',flag:0}})">
            <span class="text_span">+ 添加仓库</span>
          </p>
        </div>
      </div>
    </div>

    <div class="table">
      <el-table
        ref="multipleTable"
        :data="info"
        tooltip-effect="dark"
        style="width:100%"
        border
      >
        <el-table-column label="编号" align="center" width="80" type="index"></el-table-column>
        <el-table-column label="仓库名称" align="center" width="200" prop="storeName"></el-table-column>
        <el-table-column label="仓库位置" align="center" width="200" prop="storeAddr"></el-table-column>
        <el-table-column label="管理员姓名" align="center" prop="managerName"></el-table-column>
        <el-table-column label="联系方式" align="center" prop="tel"></el-table-column>
        <el-table-column label="仓库类型" align="center" prop="storeType">
          <template slot-scope="scope">
            <div v-if="scope.row.storeType == 0">总公司仓库</div>
            <div v-if="scope.row.storeType == 1">项目部仓库</div>
            <div v-if="scope.row.storeType == 2">施工队仓库</div>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" width="170" >
          <template slot-scope="scope">
            <a @click.prevent="$router.push({name:'addStock',params:{info:scope.row,flag:1}})">编辑</a>
          </template>
        </el-table-column>
      </el-table>
    </div>

    <!-- 分页 -->
    <div class="component-paging" v-if="info.length > 0">
      <div class="table-bottom">
        <div class="bottom-left" style="margin-left: 42px;">
        </div>
        <div class="paging">
          <div class="paging-left">
            <p>
              共
              <span>{{Math.ceil(total/pageSize)}}</span> 页/
              <span>{{total}}</span> 条数据
            </p>
          </div>
          <el-pagination
            background
            @size-change="SizeChange($event,dataInit,currentPage,pageSize)"
            @current-change="CurrentChange($event,dataInit,currentPage,pageSize)"
            :current-page="currentPage"
            :page-sizes="[10, 20, 30]"
            :page-size="pageSize"
            layout="sizes, prev, pager, next, jumper"
            :total="total"
          ></el-pagination>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        title: "仓库管理",
        outputList: true,
        info: [],
        // 数据总条数
        total: 1,
        // 每页显示数据的条数
        pageSize: 10,
        // 当前显示的页面页码
        currentPage: 1,
        multipleSelection:[],//全选
      };
    },
    mounted(){
        this.dataInit();
    },
    methods: {
      dataInit(){
        let that = this;
        let suCb = function(res){
          that.info = res.data.SysStore;
          console.log(res.data)
        }
        let erCb = function(res){
          console.log(res)
        }
        let postData = {
          pageSize:that.pageSize,
          pageCurrent:that.currentPage
        }
        let palyParam = {
          url: "/api/web/sysStore/selectSysStore",
          methods:'post',
          data: postData,
          success: suCb,
          error: erCb,
        }
        that.$https(palyParam)
      },
      //点击查询
      findRes(){
      },

    },
  };
</script>

<style scoped>

  .component-listHeader .search-header {
    width: 1100px;
    box-sizing: border-box;
    border: 1px solid rgba(228, 228, 228, 1);
    background-color: rgba(255, 255, 255, 1);
    margin: 20px auto 0;
    border-bottom: 0;
  }

  .component-listHeader .search-header .left-title {
    display: flex;
    justify-content: space-between;
    width: 100%;
    background-color: rgba(243, 243, 243, 1);
    height: 45px;
    box-sizing: border-box;
  }

  .component-listHeader .search-header .left-title .left-text {
    width: 20%;
    color: #666;
    line-height: 45px;
    font-weight: 400;
    font-size: 12px;
    text-align: left;
    margin: 0 10px 0 30px;
  }
  .component-listHeader .search-header .left-title .left-text:last-of-type{
    border:1px solid #ccc;
    background: #fff;
    text-align: center;
    width: 100px;
    height: 30px;
    margin-top: 5px;
    line-height: 30px;
    cursor: pointer;
  }

  .component-listHeader .search-header .right {
    width: 70%;
    display: flex;
    justify-content: flex-end;
    margin-right: 10px;
  }

  .component-listHeader .search-header .right button {
    padding: 0 15px;
    height: 30px;
    width: 80px;
    margin: 6px 5px;
    line-height: 30px;
    font-size: 14px;
    color: #666;
    background-color: #fff;
    border: 1px solid #ccc;
  }

  .component-listHeader .search-header .right button:hover {
    background-color: #f3f3f3;
  }

  .component-listHeader .search-header .right .right-select-margin {
    margin-top: 6px;
    margin-right: 8px;
  }
  .table {
    width: 1100px;
    margin: 0 auto;
  }
  a{
    cursor: pointer;
    color: #1ABC9C;
  }
</style>
